<?php
/**
 * Created by PhpStorm.
 * User: kun
 * Date: 26/6/19
 * Time: 18:20
 */

namespace app\api\controller\v1;


use app\api\controller\Common;
use app\common\lib\ali\Sms;
use app\common\lib\Alidayu;


class Identify extends Common
{
    /*
     * post
     * 设置短信验证码
     */
    public function save()
    {
        if (!request()->isPost()) {
            return show(config('code.error'), '您提交对数据不合法', [], 403);
        }
        //检测数据
        $validate = validate('Identify');
        if (!$validate->check(input('post.'))) {
            return show(config('code.error'), $validate->getError(), [], 403);
        }

        $id = input('post.id');
        $sms = Sms::getInstance()->sendSms($id);

        if ($sms) {
            return show(config('code.success'), 'ok', [], 201);
        } else {
            return show(config('code.error'), '发送短信失败', [], 403);
        }

    }

}